<?php 
    try{
        $payload = file_get_contents('php://input');
        if(!$payload){ 
            var_export(array('code'=>400,'msg'=>'无信息'));exit();
        }
        $data =json_decode($payload,true);
        if (empty($data)) {
            var_export(array('code'=>400,'msg'=>'无信息'));exit();
        }

        // echo '<pre>';
        // var_dump($data);die;
        if(!empty($data['password']) && $data['password'] !== 'hook@cch@0231'){ // 腾讯不知道为什么没传密码，所以有密码才验证
            var_export(array('code'=>400,'msg'=>'密码输入错误'));exit();
        }else{
            $project_name = $data['repository']['name'];
            if (!empty($project_name)) {
                $msg = exec('cd C:/phpstudy_pro/WWW/'.$project_name.'/ && git pull',$output,$status);
                var_export(array('code'=>200,'msg'=>$msg,'output'=>$output,'status'=>$status));
            }
            exit();
        }

    }catch(Exception $e){
        var_export(array('code'=>400,'msg'=>$e->getMessage()));exit;
    }

?>